<!DOCTYPE html>
<head>
  <title>__construct</title>
  <meta charset="utf-8">

  <link type="text/css" rel="stylesheet" href="../../../highlight/styles/common.css">
  <link rel="alternate stylesheet" title="Zenburn" href="../../../highlight/styles/zenburn.css">
  <link rel="alternate stylesheet" title="Pojoaque" href="../../../highlight/styles/pojoaque.css">
  <link rel="alternate stylesheet" title="MonoBlue" href="../../../highlight/styles/mono-blue.css">
  <script src="../../../highlight/styleswitcher.js" type="text/javascript"></script>

  <link type="text/css" rel="stylesheet" href="../../../showpage/css/Dialog.1.0.css">
  <script src="../../../showpage/js/jquery-1.7.2.min.js" type="text/javascript"></script>
  <script type="text/javascript" src="../../../showpage/js/Dialog.js"></script>
  <script type="text/javascript">
	$(document).ready(function(){
		$("#app_admin").click(function(){
			var def = {
				title:$(this).html(),
			}
			$.Dialog(def);
			$.Dialog("本次函数未给定title参数，但是默认title已修改,再点击下上面的link，看看title");
		});
	});
  </script>
<body>

<div id="styleswitcher"></div>

<table id="autotest">
  <tr>
    <td class="php">
<pre><code>
defined('IN_PHPCMS') or exit('No permission resources.');
//模型缓存路径
define('CACHE_MODEL_PATH',CACHE_PATH.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR);
//定义在单独操作内容的时候，同时更新相关栏目页面
define('RELATION_HTML',true);

<a id="app_admin">pc_base::load_app_class('admin','admin',0);</a>
pc_base::load_sys_class('form','',0);
pc_base::load_app_func('util');
pc_base::load_sys_class('format','',0);

class content extends admin {
	private $db,$priv_db;
	public $siteid,$categorys;
	public function __construct() {
		parent::__construct();
		$this->db = pc_base::load_model('content_model');
		$this->siteid = $this->get_siteid();
		$this->categorys = getcache('category_content_'.$this->siteid,'commons');
		//权限判断
		if(isset($_GET['catid']) && $_SESSION['roleid'] != 1 && ROUTE_A !='pass' && strpos(ROUTE_A,'public_')===false) {
			$catid = intval($_GET['catid']);
			$this->priv_db = pc_base::load_model('category_priv_model');
			$action = $this->categorys[$catid]['type']==0 ? ROUTE_A : 'init';
			$priv_datas = $this->priv_db->get_one(array('catid'=>$catid,'is_admin'=>1,'action'=>$action));
			if(!$priv_datas) showmessage(L('permission_to_operate'),'blank');
		}
	}
</code></pre>
    </td>
  </tr>
</table>
